'use strict';

const mongoose = require('mongoose');

const MerchantInfoSchema = new mongoose.Schema({
    name : String,
    icPicUrl : String,
    portraitUrl : String,
    icNum: String,
    addr : String,
    registTime : Date,
    status1: String,
    status2: String,
    token:String,
    registerNum:Number,
    rejectRea:String,
    operationTime: Date
});

MerchantInfoSchema.pre('save', function (next) {
    var doc = this;
    doc.registTime = new Date();
    doc.operationTime = new Date();
    doc.status1 = '0';
    doc.status2 = '1';
    doc.registerNum = 0;
    console.log("pre save hook!!!")
    console.log(doc)
    next();
});

mongoose.model('merchantInfo', MerchantInfoSchema);

